//
//  EditOrderDishViewController.h
//  OrderSeat
//
//  Created by 王威 on 14-2-3.
//  Copyright (c) 2014年 wangwei. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "SelectDishLeftCell.h"
#import "SelectDishRightCell.h"
#import "MWPhotoBrowser.h"
#import <AssetsLibrary/AssetsLibrary.h>

@protocol EditOrderDishCategoriesViewDelegate

-(void)selectDishCatFinished:(NSDictionary*)dic;

@end

@class EditOrderDishCategoriesView;
@class EditOrderDishDataSource;
@interface EditOrderDishViewController : BaseViewController<SelectDishLeftCellDelegate,EditOrderDishCategoriesViewDelegate,SelectDishRightCellDelegate,MWPhotoBrowserDelegate>

@property (strong, nonatomic) IBOutlet UIButton *btnNext;
@property (strong, nonatomic) IBOutlet UITableView *leftTable;
@property (strong, nonatomic) IBOutlet UITableView *rightTable;
@property (strong, nonatomic) IBOutlet UIView *footerView;
@property (strong, nonatomic) IBOutlet UIButton *titleButton;

@property (strong, nonatomic) EditOrderDishCategoriesView *selectCategoriesView;

@property (strong, nonatomic) IBOutlet UILabel *totalCountLabel;
@property (strong, nonatomic) IBOutlet UILabel *totalMoneyLabel;

@property (copy,   nonatomic) NSString *shopId;
@property (copy,   nonatomic) NSString *orderId;
@property (copy,   nonatomic) NSString *dishCatId;
@property (strong, nonatomic) EditOrderDishDataSource *dataSource;
@property (strong, nonatomic) NSMutableArray *orderDishList;
@property (strong, nonatomic) NSMutableArray *orderDishCatList;
@property (strong, nonatomic) NSMutableArray *selectedDishList;
@property (strong, nonatomic) NSMutableArray *photoList;

- (id)initWithShopId:(NSString*)shopId;

@end

@interface EditOrderDishDataSource : BaseDataSource<UITableViewDelegate,UITableViewDataSource>

@property (strong, nonatomic) EditOrderDishViewController *viewController;
@property (strong, nonatomic) NSMutableArray *smallCatList;
@property (strong, nonatomic) NSMutableArray *dishList;
@property (strong, nonatomic) NSMutableDictionary *smallCatCache;
@property (strong, nonatomic) NSMutableDictionary *dishCache;

- (void)fetchDishCategories;
- (void)fetchSmallCatWithCatId:(NSString*)catId;
- (void)fetchDishWithSmallCatId:(NSString*)catId;

@end


@interface EditOrderDishCategoriesView : UIView<UITableViewDelegate,UITableViewDataSource>

@property (strong, nonatomic) UIImageView *backImage;
@property (strong, nonatomic) NSMutableArray *categoriesList;
@property (strong, nonatomic) UITableView *categoriesTable;
@property (strong, nonatomic) id<EditOrderDishCategoriesViewDelegate> delegate;

- (void)showOrVisible;
- (void)tableViewSelectRowForCatId:(NSString *)catId;

@end
